.PHONY : test

var1 := 
var2 := $(var1)

var3 =		    
var4 = $(var3)  # 递归赋值，无法在预处理时判断是否被定义，所以var4打印出已经被定义
var3 = 3

test:
    ifdef var1
		@echo "var1 is defined"
    else
		@echo "var1 is not defined"
    endif
  
    ifdef var2
		@echo "var2 is defined"
    else
		@echo "var2 is not defined"
    endif

    ifdef var3
		@echo "var3 is defined"
    else
		@echo "var3 is not defined"
    endif

    ifdef var4
		@echo "var4 is defined"
    else
		@echo "var4 is not defined"
    endif
